package com.example.pc.videodemo.emq

import com.example.pc.videodemo.emq.model.EmqConstant
import com.example.pc.videodemo.emq.model.MqttMassgePostBase


abstract class Publisher {
    abstract val emq: EmqConstant.androidToServerEnum
    abstract val message: MqttMassgePostBase
    private var mqttHelper: MqttHelper? = null
    fun setMqttHelper(mqttHelper: MqttHelper?) {
        this.mqttHelper = mqttHelper
    }

    fun sendMessage(equipmentId: String) {
        val message = message
        val emq: EmqConstant.androidToServerEnum = emq
        message.code = emq.code
        message.sn = equipmentId.toString() + ""
        mqttHelper?.sendMessage(message)
    }
}